const remToPx = function (v) {
    // let font_size = window.getComputedStyle(document.documentElement).fontSize.replace("px", "") * 1
    let font_size = document.getElementsByTagName('html')[0].style['font-size'].replace("px", "") * 1
    return v * font_size;
}
const deepClone = (obj) => {
    // 判断传入的值是否为一个对象
    if (obj === null) {
        return obj;
    }
    // 判断对象的类型 注意这里不考虑包装类对象
    if (Object.prototype.toString.call(obj) === "[object Date]") {
        return new Date(obj);
    }
    if (Object.prototype.toString.call(obj) === "[object RegExp]") {
        return new RegExp(obj);
    }
    if (Object.prototype.toString.call(obj) === "[object Undefined]") {
        return new Error(obj);
    }
    // 判断对象是类
    let newObj = Array.isArray(obj) ? [] : {}
    for (let item in obj) {
        if (typeof obj[item] === 'object') {
            newObj[item] = deepClone(obj[item])
        } else {
            newObj[item] = obj[item]
        }
    }
    return newObj
};

export default {
    remToPx,
    deepClone
}